package com.example.gmallproduct.controller;


import com.example.gmallproduct.entity.AttrEntity;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class TestController {


    @GetMapping("/hello")
    @Cacheable(value = {"test"}, key = "'hello'")
    @ResponseBody
    public AttrEntity save() {
        AttrEntity attr = new AttrEntity();
        attr.setAttrId(1L);
        attr.setAttrName("hello");
        attr.setSearchType(1);
        return attr;
    }

    @GetMapping("/del1")
    @CacheEvict(value = {"test"})
    @ResponseBody
    public AttrEntity del() {
        return null;
    }

}
